package com.ghc.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.ghc.config.SentinelHandlersClass;
import com.ghc.service.ResumeService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/autodeliver")
public class AutodeliverController {

    @Reference
    private ResumeService resumeService;

    @RequestMapping("/checkState/{userId}")
    @SentinelResource(value = "findResumeOpenState"
            ,blockHandlerClass = SentinelHandlersClass.class,blockHandler = "handleException"
            ,fallbackClass = SentinelHandlersClass.class, fallback = "handleError")
    public Integer findResumeOpenState(@PathVariable Long userId){
        //远程调用简历微服务 RestTemplate
        return resumeService.findDefaultResumeByUserId(userId);
    }

}
